package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserFeedbackListRequest extends Request{

	private int pageNum;
	
	private int numPerPage;

	private Integer status;

	private String startTime ; 
	
	private String endTime;
	
	public UserFeedbackListRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.status = requestInfo.getIntParameter(ApiUrlParamEnum.status.getParamName(), -1);
		this.startTime = requestInfo.getParameter(ApiUrlParamEnum.startTime.getParamName(), "");
		this.endTime = requestInfo.getParameter(ApiUrlParamEnum.endTime.getParamName(),"");
		this.pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(),1);
		this.numPerPage = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 10);
		
		if (pageNum < 1) {
			throw new RequestIllegalException("error pageNum:" + pageNum);
		}
		if (numPerPage < 1) {
			throw new RequestIllegalException("error numPerPage:" + numPerPage);
		}
	}
	
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}

}
